package com.example.bigfile.common.exception;

import com.example.bigfile.common.response.ResultMsgModel;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Wangx
 * @Title:
 * @Package
 * @Description:
 * @date 2022/9/23 14:57
 */
@ControllerAdvice
@RestController
public class GlobalExceptionHandler {
    @ExceptionHandler(BusinessException.class)
    @ResponseBody
    public ResultMsgModel businessHandler(BusinessException e) {
        return ResultMsgModel.error(e.getMessage());
    }
}
